package com.ittest.mapper;

import com.ittest.controller.BooleanStrFormat;
import com.ittest.entity.*;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.factory.Mappers;

/**
 * @className: CarMapper
 * @description: TODO
 * @author: cheetah
 * @date: 2021/10/13 16:16
 * @Version: 1.0
 */
@Mapper
//@Mapper(uses = {BooleanStrFormat.class})
public interface CarMapper {

    CarMapper INSTANCE = Mappers.getMapper(CarMapper.class);

    @Mapping(source = "numberOfSeats",target = "seatCount")
    CarDto carToCarDto(Car car);

    CarDto carVoToCarDto(CarVo carVo);

    @Mapping(target = "type", expression = "java(new com.ittest.controller.BooleanStrFormat().toStr(carVo.isType()))")
    CarDto carVoToDtoWithExpression(CarVo carVo);

    void updateBwmCar(Car car, @MappingTarget BMWCar bwmCar);

    Benz4SMall mallCarToBenzMall(Car car, Mall4S mall4S);
}
